from direct.showbase.ShowBase import ShowBase

from direct.actor.Actor import Actor
import random

class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
        # Load the environment model.
        #self.environ = self.loader.loadModel("models/environment")
        #self.environ = self.loader.loadModel("humainvert3.egg")
        self.modeles=[]
        x=-4
        y=10
        z=-2
        for i in range(10):
            y=y+3
            x=-4
            z=z+1
            for j in range(5):
                #print(i)
                acte = Actor("humainvert3salut",
                                     {"salut":"humainvert3salut-salut"})
            
                # Reparent the model to render.
                acte.reparentTo(self.render)
                # Apply scale and position transforms on the model.
                acte.setScale(.2, .2, .2)
                acte.setPos(x, y, z)
                acte.loop("salut")
                acte.setColor(0.6, 0.6, 1.0, 1.0)
                self.modeles.append(acte)
                x=x+2
        #taskMgr.self.environ.loop("salut")
        taskMgr.add(self.saluer,"salut")
    def saluer(self,task):
        n=random.randrange(len(self.modeles))
        print self.modeles[n]
        self.modeles[n].loop("salut")
        return #task.cont

app = MyApp()
app.run()

